using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using buildingLib;
namespace _dmis
{
    public partial class ForeignerEdit : _dmis.WinPart
    {
        Foreigner m_foreigner;
        Owner m_owner;
        public ForeignerEdit(Foreigner foreigner,Owner owner)
        {
            InitializeComponent();
            m_foreigner = foreigner;
            m_owner = owner;
            gendersBindingSource.DataSource = Genders.GetGenders();
            foreignersBindingSource.DataSource = m_foreigner;
        }

        #region WinPart Code

        protected internal override object GetIdValue()
        {
            return m_foreigner.ID;
        }

        public override string ToString()
        {
            return m_foreigner.Doorid.ToString();
        }

        private void ResourceEdit_CurrentPrincipalChanged(object sender, EventArgs e)
        {
            ApplyAuthorizationRules();
        }
        #endregion

        private void ApplyAuthorizationRules()
        {

        }

        private void tsb_save_Click(object sender, EventArgs e)
        {
            m_owner.Foreigners.Add(m_foreigner);
            this.Close();
        }

        private void tsb_close_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

